<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path=request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Document Manager-viralpatel.net</title>
<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.min.js"></script>
<link href="<%=basePath%>/css/pagination-digg.css" rel=stylesheet type="text/css">
<link href="<%=basePath%>/css/tables.css" rel=stylesheet type="text/css">
<style type="text/css">
<!--
/*input高亮显示*/
input[type=text],textarea {
	-webkit-transition: all 0.30s ease-in-out;
	-moz-transition: all 0.30s ease-in-out;
	-ms-transition: all 0.30s ease-in-out;
	-o-transition: all 0.30s ease-in-out;
	outline: none;
	padding: 3px 0px 3px 3px;
	margin: 5px 1px 3px 0px;
	border: 1px solid #DDDDDD;
}

input[type=text]:focus,textarea:focus {
	box-shadow: 0 0 5px rgba(81, 203, 238, 1);
	padding: 3px 0px 3px 3px;
	margin: 5px 1px 3px 0px;
	border: 1px solid rgba(81, 203, 238, 1); //
	background: #E6E6FA;
}



body,table {
	font-size: 12px;
}

table { //
	table-layout: fixed;
	empty-cells: show;
	border-collapse: collapse;
	margin: 0 auto;
}

td {
	height: 20px;
}

h1,h2,h3 {
	font-size: 12px;
	margin: 0;
	padding: 0;
}

.title {
	background: #FFF;
	border: 1px solid #9DB3C5;
	padding: 1px;
	width: 90%;
	margin: 20px auto;
}

.title h1 {
	line-height: 31px;
	text-align: center;
	background: #2F589C url(th_bg2.gif);
	background-repeat: repeat-x;
	background-position: 0 0;
	color: #FFF;
}

.title th,.title td {
	border: 1px solid #CAD9EA;
	padding: 5px;
}

.hover {
	background-color: #53AB38;
	color: #fff;
}
-->
</style>
<script type="text/javascript">
 function ApplyStyle(s){
 	document.getElementById("mytab").className=s.innerText;
 }
 
 $(function(){
     addHover('mytab');
 });
 
  /**
  * 在鼠标悬停时突出显示行--jQuery处理表格  
  *
  * @tab table id
  */
 function addHover(tab){
    $('#'+tab+' tr').hover(
       function(){
          $(this).find('td').addClass('hover');
       },
    function(){
       $(this).find('td').removeClass('hover');
    }
    );
 }
  
 function turnPage(strUrl,currentPage){
		document.forms[0].action=strUrl+"?currPage=" + currentPage;		
		document.forms[0].submit();
		return false;
 }
</script>
</head>
<body>
<table width="100%" border="1" id="mytab" style="table-layout: fixed;" class="tab_css_1">
	<tr>
		<td colspan="6">
			<form:form method="post" action="${basePath}/dc/index.action" commandName="document">
			名称<form:input path="name" value="${document.name}"/>描述<form:input path="description"/>文件名称<form:input path="filename"/><input type="submit" value="查询"/>
			</form:form>
		</td>
	</tr>
	<tr>
		<th>名称</th>
		<th>描述</th>
		<th>文件名称</th>
		<th>内容类型</th>
		<th>创建时间</th>
		<th></th>
	</tr>
	<c:if test="${!empty documentList}">
	<c:forEach items="${documentList}" var="document" varStatus="status">
		<tr <c:if test="${status.count%2==0}">class="tr_css"</c:if>>
			<td>${document.name}</td>
			<td>${document.description}</td>
			<td>${document.filename}</td>
			<td>${document.contentType}</td>
			<td>${document.created}</td>
			<td width="20px"><span><a href="<%=basePath%>/dc/download/${document.id}.action">下载</a> 
			<a href="<%=basePath%>/dc/remove/${document.id}.action" onclick="return confirm('Are you sure you want to delete this document?')">删除</a>
			</span></td>
		</tr>
	</c:forEach>
	</c:if>
</table>
<!-- 分页代码开始- -->
<div class="pagination">
<c:if test="${page.pageCount>1}">
<c:if test="${page.currPage==1}">
	<span class="disabled">First</span>
	<span class="disabled">« Previous</span>
</c:if>
<c:if test="${page.currPage!=1}">
	<a href="#" onclick="turnPage('<%=basePath%>/dc/index.action','1')">First</a>
    <a href="#" onclick="turnPage('<%=basePath%>/dc/index.action','${page.currPage-1}')">« Previous</a>
</c:if>
<!-- 分页操作，如果page.count<10，就全部显示 -->
<c:if test="${page.pageCount<=10}">
	<c:forEach var="i" begin="1" end="${page.pageCount}" step="1">
		<c:if test="${page.currPage==i}">
			<span class="current">${i}</span>
		</c:if>
		<c:if test="${page.currPage!=i}">
			<a href="#" onclick="turnPage('<%=basePath%>/dc/index.action','${i}')">${i}</a>
		</c:if>
	</c:forEach>
</c:if>
<!-- 分页操作，如果page.count>10,就显示另外（10条）-->
<c:if test="${page.pageCount>10}">
	<c:set var="pageStart" value="${(page.currPage)<(page.pageCount-9)?(page.currPage):(page.pageCount-9)}" scope="page"/>
	<c:set var="pageEnd" value="${(page.pageCount)<(page.currPage+9)?(page.pageCount):(page.currPage+9)}" scope="page"/>
		<c:forEach var="i" begin="${pageStart}" end="${pageEnd}" step="1">
			<c:if test="${page.currPage==i}">
				<span class="current">${i}</span>
			</c:if>
			<c:if test="${page.currPage!=i}">
				<a href="#" onclick="turnPage('<%=basePath%>/dc/index.action','${i}')">${i}</a>
			</c:if>
		</c:forEach>
</c:if>
<c:if test="${page.currPage>=page.pageCount}">
	<span class="disabled">Next »</span>
	<span class="disabled">Last</span>
</c:if>
<c:if test="${page.currPage<page.pageCount}">
	<a href="#" onclick="turnPage('<%=basePath%>/dc/index.action','${page.currPage+1}')">Next »</a>
	<a href="#" onclick="turnPage('<%=basePath%>/dc/index.action','${page.pageCount}')">Last</a>
	<%-- <a href="<%=basePath%>/dc/index.action?currPage=${page.currPage+1}">Next »</a> --%>
</c:if>
</c:if>
<div style="float:left;color:#0000ff">总记录数:${page.count},当前页面:${page.pageCount}/${page.currPage}</div>
</div>
<!-- 分页代码结束- -->
</body>
</html>